package com.pi.springFactory;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringFactory{
     private static ApplicationContext applicationContext;
     private SpringFactory(){
    	 
     }
     public static Object getBean(String beanName){
    	  Object obj = null;
    	  if(applicationContext == null){
    	     applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
    	  }
    	  obj = (Object)applicationContext.getBean(beanName);
    	  return obj;
     }
}
